app.register.controller('detail',['$scope', '$rootScope', '$routeParams',function($scope, $rootScope, $routeParams, content) {
    //$scope.id = $routeParams.id;
    //$scope.listId = $routeParams.listId;
    //$scope.inputText = "";
    //$scope.list = content.getList($scope.listId,$scope.id);
    //log($scope.list);
    //log($rootScope.list);
    //$scope.add = function(){
    //    var id = $scope.list.length -1;
    //    $scope.list.push({id:id,text:$scope.inputText});
    //    $scope.inputText = "";
    //};
    //$scope.del = function(id){
    //    $scope.list.splice(id, 1);
    //};
    $scope.list = [];
    $scope.currentPage = Number($routeParams.pageId);
    $scope.count = 22;
    $scope.onePageNum = 6;
    if(currentPage*6<count){
        $scope.list=6;
    }else{
        $scope.list=6-(currentPage*6-count);
    }
    for(var i=0;i<$scope.onePageNum;i++){
        $scope.list.push(i);
    }
    $scope.countPage = Math.ceil($scope.count / $scope.onePageNum);
    $scope.pageList = [];
    $scope.pageNum = 7;
    if($scope.currentPage < 1 || $scope.currentPage > $scope.countPage) $scope.currentPage = 1;
    for(var i = 1;i<=$scope.countPage;i++){
        if($scope.currentPage - i < $scope.pageNum && $scope.currentPage - i >= 0){
            $scope.pageList.push(i);
        }else if(i - $scope.currentPage < $scope.pageNum && i - $scope.currentPage >= 0){
            if($scope.pageList.length < $scope.pageNum){
                $scope.pageList.push(i);
            }else{
                if(i <= $scope.currentPage + (($scope.pageNum - 1)/2)){
                    $scope.pageList.shift();
                    $scope.pageList.push(i);
                }
            }
        }
    }
    console.log($scope.pageList);
}]);